package com.seeyon.apps.gkcwplugin.quartz;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.quartz.CronScheduleBuilder;
import org.quartz.Job;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Scheduler;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;

import com.seeyon.apps.gkcwplugin.dao.DealDataDao;
import com.seeyon.apps.gkcwplugin.manager.SyncZDManager;
import com.seeyon.apps.gkcwplugin.po.ChailfSonVO;
import com.seeyon.apps.gkcwplugin.po.ChailfeiVO;
import com.seeyon.apps.gkcwplugin.po.FapiaoRzSonVO;
import com.seeyon.apps.gkcwplugin.po.FapiaoRzVO;
import com.seeyon.apps.gkcwplugin.po.FinancialDataPO;
import com.seeyon.apps.gkcwplugin.po.FukuanSonVO;
import com.seeyon.apps.gkcwplugin.po.FukuanVO;
import com.seeyon.apps.gkcwplugin.po.LaowufeiVO;
import com.seeyon.apps.gkcwplugin.po.NeibuZjNbSonVO;
import com.seeyon.apps.gkcwplugin.po.NeibuZjNbVO;
import com.seeyon.apps.gkcwplugin.po.NeibuZjSonVO;
import com.seeyon.apps.gkcwplugin.po.NeibuZjVO;
import com.seeyon.apps.gkcwplugin.util.SoapsendUtil;
import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItemPO;
import com.seeyon.ctp.common.po.filemanager.Attachment;
import com.seeyon.ctp.util.DateUtil;
import com.seeyon.ctp.workflow.messageRule.controller.MessageRuleController;

/**
 * 定时给浪潮传表单数据（表单流程结束后给浪潮传输失败的表单数据）
 * @Description: TODO(这里用一句话描述这个类的作用) 
 * @CopyRightInformation : XXX(公司名称)
 * @Prject: 
 * @ApplicationName: GKCW_Plugin
 * @Title: FormdataTask.java
 * @Package: com.seeyon.apps.gkcwplugin.quartz
 * @author: wtxx
 * @date: 2023年5月26日 下午4:04:47
 * @version: V1.0
 */
public class FormdataTask implements Job{
	private static final Log logger=LogFactory.getLog(FormdataTask.class);
	private DealDataDao dealDataDao=(DealDataDao)AppContext.getBean("dealDataDao");
	private SyncZDManager syncZDManager=(SyncZDManager) AppContext.getBean("syncZDManager");

	@Override
	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		System.out.println("-----------处理表单数据任务");
		Date date=new Date();
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		logger.info("-------------处理表单数据任务，进入FormdataTask类execute方法,time:"+sf.format(date));
		String fukuanCode=AppContext.getSystemProperty("gkcwplugin.fukuanCode");
		String chailfCode=AppContext.getSystemProperty("gkcwplugin.chailfCode");
		String laowfCode=AppContext.getSystemProperty("gkcwplugin.laowfCode");
		String fapiaorzCode=AppContext.getSystemProperty("gkcwplugin.fapiaorzCode");
		String neibuzjCode=AppContext.getSystemProperty("gkcwplugin.neibuzjCode");
		String neibuzjNbCode=AppContext.getSystemProperty("gkcwplugin.neibuzjNbCode");
		try {
			List<FinancialDataPO> list=dealDataDao.selectFinancial();
			if (list!=null&&list.size()>0) {
				String sessionId=syncZDManager.systemInOut();
				if (sessionId!=null&&!"".equals(sessionId)&&!"null".equals(sessionId)) {
					for(FinancialDataPO po:list) {
						long id=po.getId();
						String temCode=po.getTemplateCode();
						String summaryId=po.getSummaryId();
						String formrecordId=po.getFormRecordId();
						//查询附件表是否有附件
						List<Attachment> attaList=dealDataDao.attachmentList(summaryId.toString(),false);
						if (fukuanCode.equals(temCode)) {
							logger.info("-----------------------付款审批表");
							String fkspUrl=AppContext.getSystemProperty("gkcwplugin.fkspUrl");
							//组装付款审批接口xml参数
							String fkXml=getFukuanXml(formrecordId, sessionId, attaList);
							logger.info("-----------------------付款审批表接口xml参数："+fkXml);
							//调用付款审批表接口
							String fkResult=new SoapsendUtil().postSoap(fkXml, fkspUrl);
							logger.info("----------------------付款审批表接口返回信息："+fkResult);
							//解析接口返回信息
							String res=getResult(fkResult);
							if (!"true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "1", 2);
								logger.info("-------------------定时发送付款审批表失败");
							}else if ("true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "0", 2);
								logger.info("-------------------定时发送付款审批表成功");
							}
							
						}else if (chailfCode.equals(temCode)) {
							logger.info("-----------------------差旅费报销单");
							String chailfUrl=AppContext.getSystemProperty("gkcwplugin.chlfUrl");
							//组装差旅费接口xml参数
							String chailfXml=getChailfXml(formrecordId, sessionId, attaList);
							logger.info("-----------------------差旅费接口xml参数："+chailfXml);
							//调用差旅费接口
							String chailfResult=new SoapsendUtil().postSoap(chailfXml, chailfUrl);
							logger.info("----------------------差旅费接口返回信息："+chailfResult);
							//解析接口返回信息
							String res=getResult(chailfResult);
							if (!"true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "1", 2);
								logger.info("-------------------定时发送差旅费报销单失败");
							}else if ("true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "0", 2);
								logger.info("-------------------定时发送差旅费报销单成功");
							}
						}else if (laowfCode.equals(temCode)) {
							logger.info("-----------------------劳务费发放表");
							String lwfUrl=AppContext.getSystemProperty("gkcwplugin.lwfUrl");
							//组装劳务费接口xml参数
							String lwfXml=getLwfXml(formrecordId, sessionId, attaList);
							logger.info("-----------------------劳务费接口xml参数："+lwfXml);
							//调用劳务费接口
							String lwfResult=new SoapsendUtil().postSoap(lwfXml, lwfUrl);
							logger.info("----------------------劳务费接口返回信息："+lwfResult);
							//解析接口返回信息
							String res=getResult(lwfResult);
							if (!"true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "1", 2);
								logger.info("-------------------定时发送劳务费发放表失败");
							}else if ("true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "0", 2);
								logger.info("-------------------定时发送劳务费发放表成功");
							}
							
						}else if (fapiaorzCode.equals(temCode)) {
							logger.info("-----------------------发票入账单");
							String fprzUrl=AppContext.getSystemProperty("gkcwplugin.fprzUrl");
							//组装发票入账单接口xml参数
							String fprzXml=getFaprzXml(formrecordId, sessionId, attaList);
							logger.info("-----------------------发票入账单接口xml参数："+fprzXml);
							//调用发票入账接口
							String fprzResult=new SoapsendUtil().postSoap(fprzXml, fprzUrl);
							logger.info("----------------------发票入账接口返回信息："+fprzResult);
							//解析接口返回信息
							String res=getResult(fprzResult);
							if (!"true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "1", 2);
								logger.info("-------------------定时发送发票入账单失败");
							}else if ("true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "0", 2);
								logger.info("-------------------定时发送发票入账单成功");
							}
							
						}else if (neibuzjCode.equals(temCode)) {
							logger.info("-----------------------内部资金拨付单");
							String nbzjUrl=AppContext.getSystemProperty("gkcwplugin.zjbfdUrl");
							//组装内部资金拨付单接口xml参数
							String nbzjXml=getNeibuzjXml(formrecordId, sessionId, attaList);
							logger.info("-----------------------内部资金拨付单接口xml参数："+nbzjXml);
							//调用内部资金拨付单接口
							String nbzjResult=new SoapsendUtil().postSoap(nbzjXml, nbzjUrl);
							logger.info("----------------------内部资金拨付单接口返回信息："+nbzjResult);
							//解析接口返回信息
							String res=getResult(nbzjResult);
							if (!"true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "1", 2);
								logger.info("-------------------定时发送内部资金拨付单失败");
							}else if ("true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "0", 2);
								logger.info("-------------------定时发送内部资金拨付单成功");
							}
							
						}else if (neibuzjNbCode.equals(temCode)) {
							logger.info("-----------------------内部资金拨付单（内部路径）");
							String nbzjNbUrl=AppContext.getSystemProperty("gkcwplugin.zjbfdUrl");
							//组装内部资金拨付单（内部路径）接口xml参数
							String nbzjNbXml=getNeibuzjNbxml(formrecordId, sessionId, attaList);
							logger.info("-----------------------内部资金拨付单（内部路径）接口xml参数："+nbzjNbXml);
							//调用内部资金拨付单接口
							String nbzjNbResult=new SoapsendUtil().postSoap(nbzjNbXml, nbzjNbUrl);
							logger.info("----------------------内部资金拨付单（内部路径）接口返回信息："+nbzjNbResult);
							//解析接口返回信息
							String res=getResult(nbzjNbResult);
							if (!"true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "1", 2);
								logger.info("-------------------定时发送内部资金拨付单(内部路径)失败");
							}else if ("true".equals(res)) {
								int count=dealDataDao.updateFinancial(id, "0", 2);
								logger.info("-------------------定时发送内部资金拨付单(内部路径)成功");
							}
						}
					}
				}
				
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static void initCurrentEvent() {
		try {
			StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory();
			Scheduler scheduler = stdSchedulerFactory.getScheduler();
			JobDetail jobDetail=JobBuilder.newJob(FormdataTask.class).withIdentity("job2", "group2").build();
			Trigger trigger = TriggerBuilder.newTrigger()
					.withIdentity("trigger2",  "triggerGroup2")
					.startNow()
					.withSchedule(
							CronScheduleBuilder.cronSchedule("0 0 0 * * ?")
					).build();
			scheduler.scheduleJob(jobDetail, trigger);
			scheduler.start();
			Thread.sleep(10L * 1000L);
		} catch (Exception e) {
			logger.info("---------------------------处理失败表单数据定时任务异常！");
			e.printStackTrace();
			
		}
	}
	//解析接口返回的结果
	public String getResult(String result) {
		try {
			//字符串转xml
			Document doc=DocumentHelper.parseText(result);
			//获取根节点
			Element root=doc.getRootElement();
			logger.info("-----------------根节点："+root.getName());
			Iterator iterator=root.element("Body").element("WriteResponse").elementIterator("WriteResult");
			while(iterator.hasNext()) {
				Element element=(Element) iterator.next();
				String r=element.elementTextTrim("Result");
				logger.info("-------------------解析后，Result:"+r);
				if ("true".equals(r)) {
					logger.info("---------------------接口返回成功");
				}else {
					String msg=element.elementTextTrim("Message");
					logger.info("---------------------接口返回失败，异常信息为："+msg);
				}
				return r;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	//组装差旅费xml参数
	public String getChailfXml(String formRecordId,String sessionId,List<Attachment> attaList) {
		ChailfeiVO vo=dealDataDao.findChailfById(Long.valueOf(formRecordId));
		Long id=vo.getId();
		String unit=vo.getUnit();
		String dept=vo.getDept();
		Date riqi=vo.getRiqi();
		String reason=vo.getReason();//出差事由
		String sbjerdx=vo.getSbjerdx();//申报金额大写
		String sfjerdx=vo.getSfjerdx();//实付金额大写
		BigDecimal fyhj=vo.getFyhj();//费用合计
		String fkyh=vo.getFkyh();//付款银行 银行id
		String fkyhzh=vo.getFkyhzh();//付款银行账号 银行账号
		StringBuffer sb=new StringBuffer();
		sb.append(getHeadXml(sessionId));
		//主对象
		sb.append("<tem:record>");
		sb.append("<tem:JTGKCLBX_NM>"+String.valueOf(id)+"</tem:JTGKCLBX_NM>");
		sb.append("<tem:JTGKCLBX_DWBH>"+unit+"</tem:JTGKCLBX_DWBH>");
		sb.append("<tem:JTGKCLBX_BMBH>"+dept+"</tem:JTGKCLBX_BMBH>");
		String sj=DateUtil.format(riqi, "yyyy-MM-dd");
		sb.append("<tem:JTGKCLBX_PZRQ>"+sj+"</tem:JTGKCLBX_PZRQ>");
		sb.append("<tem:JTGKCLBX_FJS></tem:JTGKCLBX_FJS>");
		sb.append("<tem:JTGKCLBX_SFZF>0</tem:JTGKCLBX_SFZF>");
		//从对象
		sb.append("<tem:JTGKCLBXMXS>");
		
		List<ChailfSonVO> sonList=dealDataDao.findChailfSon(Long.valueOf(formRecordId));
		if(sonList!=null&&sonList.size()>0) {
			for(ChailfSonVO sonVO:sonList) {
				sb.append("<tem:JTGKCLBXMX>");
				Long sonId=sonVO.getId();
				Date startTime=sonVO.getStartTime();
				Date endTime=sonVO.getEndTime();
				String startPlace=sonVO.getStartPlace();//起地点
				String endPlace=sonVO.getEndPlace();//止地点
				String transport=sonVO.getTransport();//交通方式
				String cclx=sonVO.getCclx();//出差类型
				BigDecimal jtfwhsj=sonVO.getJtfwhsj();//交通费为含税价
				BigDecimal jtfser=sonVO.getJtfser();//交通费税额
				BigDecimal jtfshuil=sonVO.getJtfshuil();//交通费税率
				BigDecimal csjjtf=sonVO.getCsjjtf();//城市间交通费
				BigDecimal zsfwhsj=sonVO.getZsfwhsj();//住宿费未含税价
				BigDecimal zsfshuij=sonVO.getZsfshuij();//住宿费税金
				BigDecimal zsfshuil=sonVO.getZsfshuil();//住宿费税率
				BigDecimal zsf=sonVO.getZsf();//住宿费
				BigDecimal hsbzfts=sonVO.getHsbzfts();//伙食补助费天数
				int hsts=hsbzfts.intValue();
				BigDecimal hsbzfjer=sonVO.getHsbzfjer();//伙食补助费金额
				BigDecimal snjtfts=sonVO.getSnjtfts();//市内交通费天数
				int snts=snjtfts.intValue();
				BigDecimal snjtfjer=sonVO.getSnjtfjer();//市内交通费金额
				BigDecimal pxfeiwhsj=sonVO.getPxfeiwhsj();//培训费未含税价
				BigDecimal pxfeisj=sonVO.getPxfeisj();//培训费税金
				BigDecimal pxfeisl=sonVO.getPxfeisl();//培训费税率
				BigDecimal pxfei=sonVO.getPxfei();//培训费
				BigDecimal zhaodf=sonVO.getZhaodf();//招待费
				BigDecimal otherFee=sonVO.getOtherFee();//其他费用
				BigDecimal gerenbyj=sonVO.getGerenbyj();//个人备用金
				String jkr=sonVO.getJkr();//借款人
				BigDecimal xiaoji=sonVO.getXiaoji();//小计
				String remark=sonVO.getRemark();//备注
				sb.append("<tem:JTGKCLBXMX_NM>"+String.valueOf(sonId)+"</tem:JTGKCLBXMX_NM>");
				sb.append("<tem:JTGKCLBXMX_ZBNM>"+String.valueOf(id)+"</tem:JTGKCLBXMX_ZBNM>");
				sb.append("<tem:JTGKCLBXMX_CCSY>"+reason+"</tem:JTGKCLBXMX_CCSY>");
				String kssj=DateUtil.format(startTime, "yyyy-MM-dd");
				String jssj=DateUtil.format(endTime, "yyyy-MM-dd");
				sb.append("<tem:JTGKCLBXMX_KSSJ>"+kssj+"</tem:JTGKCLBXMX_KSSJ>");
				sb.append("<tem:JTGKCLBXMX_JSSJ>"+jssj+"</tem:JTGKCLBXMX_JSSJ>");
				sb.append("<tem:JTGKCLBXMX_KSDD>"+startPlace+"</tem:JTGKCLBXMX_KSDD>");
				sb.append("<tem:JTGKCLBXMX_JSDD>"+endPlace+"</tem:JTGKCLBXMX_JSDD>");
				CtpEnumItemPO ctpEnumItem=dealDataDao.getEnum(transport);
				if (ctpEnumItem!=null) {
					sb.append("<tem:JTGKCLBXMX_JTFS>"+ctpEnumItem.getShowvalue()+"</tem:JTGKCLBXMX_JTFS>");
				}else {
					sb.append("<tem:JTGKCLBXMX_JTFS></tem:JTGKCLBXMX_JTFS>");
				}
				CtpEnumItemPO cclxItem=dealDataDao.getEnum(cclx);
				if (cclx!=null) {
					sb.append("<tem:JTGKCLBXMX_CCLB>"+cclxItem.getShowvalue()+"</tem:JTGKCLBXMX_CCLB>");
				}else {
					sb.append("<tem:JTGKCLBXMX_CCLB></tem:JTGKCLBXMX_CCLB>");
				}
				
				sb.append("<tem:JTGKCLBXMX_KCJTBHS>"+jtfwhsj+"</tem:JTGKCLBXMX_KCJTBHS>");
				sb.append("<tem:JTGKCLBXMX_KCJTSE>"+jtfser+"</tem:JTGKCLBXMX_KCJTSE>");
				sb.append("<tem:JTGKCLBXMX_KCJTSL>"+jtfshuil+"</tem:JTGKCLBXMX_KCJTSL>");
				sb.append("<tem:JTGKCLBXMX_KCJTHSJE>"+csjjtf+"</tem:JTGKCLBXMX_KCJTHSJE>");
				sb.append("<tem:JTGKCLBXMX_ZSBHS>"+zsfwhsj+"</tem:JTGKCLBXMX_ZSBHS>");
				sb.append("<tem:JTGKCLBXMX_ZSSE>"+zsfshuij+"</tem:JTGKCLBXMX_ZSSE>");
				sb.append("<tem:JTGKCLBXMX_ZSSL>"+zsfshuil+"</tem:JTGKCLBXMX_ZSSL>");
				sb.append("<tem:JTGKCLBXMX_ZSHSJE>"+zsf+"</tem:JTGKCLBXMX_ZSHSJE>");
				sb.append("<tem:JTGKCLBXMX_CBTS>"+hsts+"</tem:JTGKCLBXMX_CBTS>");
				sb.append("<tem:JTGKCLBXMX_CBJE>"+hsbzfjer+"</tem:JTGKCLBXMX_CBJE>");
				sb.append("<tem:JTGKCLBXMX_SNJTTS>"+snts+"</tem:JTGKCLBXMX_SNJTTS>");
				sb.append("<tem:JTGKCLBXMX_SNJTJE>"+snjtfjer+"</tem:JTGKCLBXMX_SNJTJE>");
				sb.append("<tem:JTGKCLBXMX_PXFBHS>"+pxfeiwhsj+"</tem:JTGKCLBXMX_PXFBHS>");
				sb.append("<tem:JTGKCLBXMX_PXFSE>"+pxfeisj+"</tem:JTGKCLBXMX_PXFSE>");
				sb.append("<tem:JTGKCLBXMX_PXFSL>"+pxfeisl+"</tem:JTGKCLBXMX_PXFSL>");
				sb.append("<tem:JTGKCLBXMX_PXFHSJE>"+pxfei+"</tem:JTGKCLBXMX_PXFHSJE>");
				sb.append("<tem:JTGKCLBXMX_ZDF>"+zhaodf+"</tem:JTGKCLBXMX_ZDF>");
				sb.append("<tem:JTGKCLBXMX_QTFY>"+otherFee+"</tem:JTGKCLBXMX_QTFY>");
				sb.append("<tem:JTGKCLBXMX_GRBYJ>"+gerenbyj+"</tem:JTGKCLBXMX_GRBYJ>");
				sb.append("<tem:JTGKCLBXMX_JKR>"+jkr+"</tem:JTGKCLBXMX_JKR>");
				sb.append("<tem:JTGKCLBXMX_HJJE>"+xiaoji+"</tem:JTGKCLBXMX_HJJE>");
				sb.append("<tem:JTGKCLBXMX_BZ>"+remark+"</tem:JTGKCLBXMX_BZ>");
				sb.append("<tem:JTGKCLBXMX_ZHJJE>"+fyhj+"</tem:JTGKCLBXMX_ZHJJE>");
				sb.append("<tem:JTGKCLBXMX_ZSBJE>"+sbjerdx+"</tem:JTGKCLBXMX_ZSBJE>");
				sb.append("<tem:JTGKCLBXMX_ZZFJE>"+sfjerdx+"</tem:JTGKCLBXMX_ZZFJE>");
				sb.append("<tem:JTGKCLBXMX_FKYH>"+fkyh+"</tem:JTGKCLBXMX_FKYH>");
				sb.append("<tem:JTGKCLBXMX_FKYHZH>"+fkyhzh+"</tem:JTGKCLBXMX_FKYHZH>");
				sb.append("</tem:JTGKCLBXMX>");
			}
		}else {
			sb.append("<tem:JTGKCLBXMX></tem:JTGKCLBXMX>");
		}
		
		sb.append("</tem:JTGKCLBXMXS>");
		String fjXml=getAttaXml(attaList, id);
		sb.append(fjXml);
		sb.append("</tem:record>");
		sb.append("</tem:Write>");
		sb.append("</soap:Body>");
		sb.append("</soap:Envelope>");
		return sb.toString();
	}
	//拼接付款审批xml参数
	public String getFukuanXml(String formRecordId,String sessionId,List<Attachment> attaList) {
		FukuanVO fukuanVO=dealDataDao.findFukuanById(Long.valueOf(formRecordId));
		Long id=fukuanVO.getId();
		String unitCode=fukuanVO.getUnitCode();
		String dept=fukuanVO.getDept();
		Date riqi=fukuanVO.getRiqi();
		String content=fukuanVO.getContent();
		BigDecimal zerhjxx=fukuanVO.getZerhjxx();
//		String zjjerdx=fukuanVO.getZjjerdx();
//		String fkyh=fukuanVO.getFkyh();
//		String fkyhid=fukuanVO.getFkyhid();
//		String fkyhzh=fukuanVO.getFkyhzh();
//		String fknm=fukuanVO.getFknm();
		
		StringBuffer sb=new StringBuffer();
		sb.append(getHeadXml(sessionId));
		//主对象
		sb.append("<tem:record>");
		sb.append("<tem:JTGKFKSP_NM>"+String.valueOf(id)+"</tem:JTGKFKSP_NM>");
		sb.append("<tem:JTGKFKSP_DWBH>"+unitCode+"</tem:JTGKFKSP_DWBH>");
		String sj=DateUtil.format(riqi, "yyyy-MM-dd");
		sb.append("<tem:JTGKFKSP_PZRQ>"+sj+"</tem:JTGKFKSP_PZRQ>");
		sb.append("<tem:JTGKFKSP_FJS></tem:JTGKFKSP_FJS>");
		sb.append("<tem:JTGKFKSP_SFZF>0</tem:JTGKFKSP_SFZF>");
		//从对象集合
		sb.append("<tem:JTGKFKSPMXS>");
		sb.append("<tem:JTGKFKSPMX>");
		//查询付款审批表单子表
		List<FukuanSonVO> sonList=dealDataDao.findFukuanSon(Long.valueOf(formRecordId));
		if(sonList!=null&&sonList.size()>0) {
			for(FukuanSonVO fukuanSonVO:sonList) {
				Long sonId=fukuanSonVO.getId();
				String ytsm=fukuanSonVO.getYtsm();//用途说明
				String skdw=fukuanSonVO.getSkdw();//收款单位
				String skdwid=fukuanSonVO.getSkdwCode();//收款单位编码
				String skyhid=fukuanSonVO.getSkyhid();//收款银行 id
				String skzh=fukuanSonVO.getSkzh();//收款账号
				String sknm=fukuanSonVO.getSknm();//收款银行数据内码
				//String khhjzh=fukuanSonVO.getKhhjzh();//开户行及账号
				BigDecimal ytjer=fukuanSonVO.getYtjer();//用途金额
				String ytbz=fukuanSonVO.getYtbz();//用途备注
				sb.append("<tem:JTGKFKSPMX_NM>"+String.valueOf(sonId)+"</tem:JTGKFKSPMX_NM>");
				sb.append("<tem:JTGKFKSPMX_ZBNM>"+String.valueOf(id)+"</tem:JTGKFKSPMX_ZBNM>");
				sb.append("<tem:JTGKFKSPMX_XMNR>"+content+"</tem:JTGKFKSPMX_XMNR>");
				sb.append("<tem:JTGKFKSPMX_YTSM>"+ytsm+"</tem:JTGKFKSPMX_YTSM>");
				sb.append("<tem:JTGKFKSPMX_SKDW>"+skdwid+"</tem:JTGKFKSPMX_SKDW>");
				sb.append("<tem:JTGKFKSPMX_KHH>"+skyhid+"</tem:JTGKFKSPMX_KHH>");
				sb.append("<tem:JTGKFKSPMX_KHHZH>"+sknm+"</tem:JTGKFKSPMX_KHHZH>");
				sb.append("<tem:JTGKFKSPMX_JE>"+ytjer+"</tem:JTGKFKSPMX_JE>");
				sb.append("<tem:JTGKFKSPMX_BZ>"+ytbz+"</tem:JTGKFKSPMX_BZ>");
//				sb.append("<tem:JTGKFKSPMX_ZJE>"+zerhjxx+"</tem:JTGKFKSPMX_ZJE>");
//				sb.append("<tem:JTGKFKSPMX_ZJEDX>"+zjjerdx+"</tem:JTGKFKSPMX_ZJEDX>");
//				sb.append("<tem:JTGKFKSPMX_FKYH>"+fkyhid+"</tem:JTGKFKSPMX_FKYH>");
//				sb.append("<tem:JTGKFKSPMX_FKYHZH>"+fknm+"</tem:JTGKFKSPMX_FKYHZH>");
			}
		}
		sb.append("</tem:JTGKFKSPMX>");
		sb.append("</tem:JTGKFKSPMXS>");
		String fjXml=getAttaXml(attaList, id);
		sb.append(fjXml);
		sb.append("</tem:record>");
		sb.append("</tem:Write>");
		sb.append("</soap:Body>");
		sb.append("</soap:Envelope>");
		return sb.toString();
	}
	//组装附件xml
	public String getAttaXml(List<Attachment> attaList,Long formId) {
		StringBuffer sb=new StringBuffer();
		sb.append("<tem:FLLIST>");
		if (attaList!=null&&attaList.size()>0) {
			for(Attachment attachment:attaList) {
				sb.append("<tem:JTGKFJJL>");
				sb.append("<tem:JTGKFJJL_NM>"+attachment.getId()+"</tem:JTGKFJJL_NM>");
				sb.append("<tem:JTGKFJJL_BILLID>"+String.valueOf(formId)+"</tem:JTGKFJJL_BILLID>");
				sb.append("<tem:JTGKFJJL_FJID>"+attachment.getFileUrl()+"</tem:JTGKFJJL_FJID>");
				sb.append("<tem:JTGKFJJL_FJNAME>"+attachment.getFilename()+"</tem:JTGKFJJL_FJNAME>");
				sb.append("<tem:JTGKFJJL_FJSIZE>"+attachment.getSize()+"</tem:JTGKFJJL_FJSIZE>");
				sb.append("<tem:JTGKFJJL_CJRQ>"+DateUtil.format(attachment.getCreatedate(), "yyyy-MM-dd")+"</tem:JTGKFJJL_CJRQ>");
				sb.append("</tem:JTGKFJJL>");
			}
		}
		sb.append("</tem:FLLIST>");
		return sb.toString();
	}
	public String getHeadXml(String sessionId) {
		StringBuffer sb=new StringBuffer();
		sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
		//sb.append("<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tem=\"http://tempuri.org/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
		sb.append("<soap:Envelope xmlns:tem=\"http://tempuri.org/\" xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">");
		sb.append("<soap:Header>");
		sb.append("<tem:GsSession>");
		sb.append("<tem:SessionID>"+sessionId+"</tem:SessionID>");
		sb.append("</tem:GsSession>");
		sb.append("</soap:Header>");
		sb.append("<soap:Body>");
		sb.append("<tem:Write xmlns=\"http://WebXml.com.cn/\">");
		return sb.toString();
	}
	//拼接劳务费xml参数
		public String getLwfXml(String formRecordId,String sessionId,List<Attachment> attaList) {
			LaowufeiVO laowufeiVO=dealDataDao.findLaowufById(Long.valueOf(formRecordId));
			Long id=laowufeiVO.getId();
			Date writeTime=laowufeiVO.getWriteTime();
			//String sqbm=laowufeiVO.getSqbm();
			String bmCode=laowufeiVO.getBmCode();
			String unitCode=laowufeiVO.getUnitCode();
			String sqr=laowufeiVO.getSqr();
			String name=laowufeiVO.getName();
			String idcard=laowufeiVO.getIdcard();
			String zhiwu=laowufeiVO.getZhiwu();
			String skkhh=laowufeiVO.getSkkhh();
			Date times=laowufeiVO.getTimes();
			String place=laowufeiVO.getPlace();
			String keshi=laowufeiVO.getKeshi();
			String content=laowufeiVO.getContent();
			BigDecimal jkfy=laowufeiVO.getJkfy();
			String jkfydx=laowufeiVO.getJkfydx();
			String remark=laowufeiVO.getRemark();
			String fkzh=laowufeiVO.getFkzh();//付款账号
			String skkhm=laowufeiVO.getSkkhm();
			String skyhzh=laowufeiVO.getSkyhzh();//收款银行账号-银行的数据内码
			String yhid=laowufeiVO.getYhid();//付款银行id
			
			//String fkyh=laowufeiVO.getFkyh();//付款银行
			String fkyhzh=laowufeiVO.getFkyhzh();//付款银行账号-银行账户的数据内码
			String skyhid=laowufeiVO.getSkyhid();//收款银行id
			
			StringBuffer sb=new StringBuffer();
			sb.append(getHeadXml(sessionId));
			//主对象
			sb.append("<tem:record>");
			sb.append("<tem:JTGKLWF_NM>"+String.valueOf(id)+"</tem:JTGKLWF_NM>");
			sb.append("<tem:JTGKLWF_DWBH>"+unitCode+"</tem:JTGKLWF_DWBH>");//单位编号
			String pzrq=DateUtil.format(writeTime, "yyyy-MM-dd");
			sb.append("<tem:JTGKLWF_PZRQ>"+pzrq+"</tem:JTGKLWF_PZRQ>");
			sb.append("<tem:JTGKLWF_FJS></tem:JTGKLWF_FJS>");
			sb.append("<tem:JTGKLWF_SFZF>0</tem:JTGKLWF_SFZF>");
			//从对象集合
			sb.append("<tem:JTGKLWFMXS>");
			sb.append("<tem:JTGKLWFMX>");
			sb.append("<tem:JTGKLWFMX_NM>"+String.valueOf(id)+"</tem:JTGKLWFMX_NM>");
			sb.append("<tem:JTGKLWFMX_ZBNM>"+String.valueOf(id)+"</tem:JTGKLWFMX_ZBNM>");
			sb.append("<tem:JTGKLWFMX_BMBH>"+bmCode+"</tem:JTGKLWFMX_BMBH>");
			sb.append("<tem:JTGKLWFMX_SQR>"+sqr+"</tem:JTGKLWFMX_SQR>");
			sb.append("<tem:JTGKLWFMX_ZJXM>"+name+"</tem:JTGKLWFMX_ZJXM>");
			sb.append("<tem:JTGKLWFMX_ZJSFZ>"+idcard+"</tem:JTGKLWFMX_ZJSFZ>");
			sb.append("<tem:JTGKLWFMX_ZW>"+zhiwu+"</tem:JTGKLWFMX_ZW>");
			sb.append("<tem:JTGKLWFMX_KHH>"+skyhid+"</tem:JTGKLWFMX_KHH>");
			sb.append("<tem:JTGKLWFMX_KHHZH>"+skyhzh+"</tem:JTGKLWFMX_KHHZH>");
			String sj=DateUtil.format(times, "yyyy-MM-dd");
			sb.append("<tem:JTGKLWFMX_SJ>"+sj+"</tem:JTGKLWFMX_SJ>");
			sb.append("<tem:JTGKLWFMX_DD>"+place+"</tem:JTGKLWFMX_DD>");
			sb.append("<tem:JTGKLWFMX_KS>"+keshi+"</tem:JTGKLWFMX_KS>");
			sb.append("<tem:JTGKLWFMX_NY>"+content+"</tem:JTGKLWFMX_NY>");
			sb.append("<tem:JTGKLWFMX_JKFY>"+jkfy+"</tem:JTGKLWFMX_JKFY>");
			sb.append("<tem:JTGKLWFMX_JKFYDX>"+jkfydx+"</tem:JTGKLWFMX_JKFYDX>");
			sb.append("<tem:JTGKLWFMX_BZ>"+remark+"</tem:JTGKLWFMX_BZ>");
			sb.append("<tem:JTGKLWFMX_FKZH></tem:JTGKLWFMX_FKZH>");
			sb.append("<tem:JTGKLWFMX_FKYH>"+yhid+"</tem:JTGKLWFMX_FKYH>");
			sb.append("<tem:JTGKLWFMX_FKYHZH>"+fkyhzh+"</tem:JTGKLWFMX_FKYHZH>");
			sb.append("</tem:JTGKLWFMX>");
			sb.append("</tem:JTGKLWFMXS>");
			//从对象附件
			String fjXml=getAttaXml(attaList, id);
			sb.append(fjXml);
			sb.append("</tem:record>");
			sb.append("</tem:Write>");
			sb.append("</soap:Body>");
			sb.append("</soap:Envelope>");
			return sb.toString();
		}
		//组装发票入账xml参数
		public String getFaprzXml(String formRecordId,String sessionId,List<Attachment> attaList) {
			FapiaoRzVO fpRzVO=dealDataDao.findFapiaoRzById(Long.valueOf(formRecordId));
			Long id=fpRzVO.getId();
			String unit=fpRzVO.getUnit();
			String unitCode=fpRzVO.getUnitCode();
			Date riqi =fpRzVO.getRiqi();
//			BigDecimal htjerhj=fpRzVO.getHtjerhj();//合同金额合计
//			String xhdwmc=fpRzVO.getXhdwmc();//销货单位名称
//			String xhdwsh=fpRzVO.getXhdwsh();//销货单位税号
//			String xhfkhh=fpRzVO.getXhfkhh();//销货方开户行
//			String xhfzh=fpRzVO.getXhfzh();//销货方银行账号
//			String xhfyhid=fpRzVO.getXhfyhid();//销货方银行id
			String xmnr=fpRzVO.getXmnr();//项目内容
//			BigDecimal bhsjerzj=fpRzVO.getBhsjerzj();//不含税金额总计
//			BigDecimal serzj=fpRzVO.getSerzj();//税额总计
//			BigDecimal jszj=fpRzVO.getJszj();//价税总计
			
			StringBuffer sb=new StringBuffer();
			sb.append(getHeadXml(sessionId));
			//主对象
			sb.append("<tem:record>");
			sb.append("<tem:JTGKFPRZ_NM>"+String.valueOf(id)+"</tem:JTGKFPRZ_NM>");
			sb.append("<tem:JTGKFPRZ_DWBH>"+unitCode+"</tem:JTGKFPRZ_DWBH>");
			String sj=DateUtil.format(riqi, "yyyy-MM-dd");
			sb.append("<tem:JTGKFPRZ_PZRQ>"+sj+"</tem:JTGKFPRZ_PZRQ>");
			sb.append("<tem:JTGKFPRZ_FJS></tem:JTGKFPRZ_FJS>");
			sb.append("<tem:JTGKFPRZ_SFZF>0</tem:JTGKFPRZ_SFZF>");
			//从对象
			sb.append("<tem:JTGKFPRZMXS>");
			
			//查询发票入账单子表
			List<FapiaoRzSonVO> fpSonList=dealDataDao.findFapiaoRzSon(Long.valueOf(formRecordId));
			if(fpSonList!=null&&fpSonList.size()>0) {
				for(FapiaoRzSonVO sonVO:fpSonList) {
					sb.append("<tem:JTGKFPRZMX>");
					Long sonId=sonVO.getId();
					Long formmainId=sonVO.getFormmainId();
					String bxxmnr=sonVO.getBxxmnr();//报销项目内容
					String xmcode=sonVO.getBxxmnrCode();
					String dept=sonVO.getDept();
					String fplx=sonVO.getFplx();//发票类型
					String fphm=sonVO.getFphm();//发票号码
					String fpdm=sonVO.getFpdm();//发票代码
					Date kprq=sonVO.getKprq();
					BigDecimal shuier=sonVO.getShuier();//税额
					BigDecimal bhsjer=sonVO.getBhsjer();//不含税金额
					BigDecimal shuil=sonVO.getShuil();//税率
//					BigDecimal jshj=sonVO.getJshj();//价税合计
					sb.append("<tem:JTGKFPRZMX_NM>"+String.valueOf(sonId)+"</tem:JTGKFPRZMX_NM>");
					sb.append("<tem:JTGKFPRZMX_ZBNM>"+String.valueOf(id)+"</tem:JTGKFPRZMX_ZBNM>");
					sb.append("<tem:JTGKFPRZMX_XMNR>"+xmnr+"</tem:JTGKFPRZMX_XMNR>");
//					sb.append("<tem:JTGKFPRZMX_XHDW>"+xhdwmc+"</tem:JTGKFPRZMX_XHDW>");
//					sb.append("<tem:JTGKFPRZMX_XHDWSH>"+xhdwsh+"</tem:JTGKFPRZMX_XHDWSH>");
//					sb.append("<tem:JTGKFPRZMX_XHKHH>"+xhfyhid+"</tem:JTGKFPRZMX_XHKHH>");
//					sb.append("<tem:JTGKFPRZMX_XHYHZH>"+xhfzh+"</tem:JTGKFPRZMX_XHYHZH>");
					sb.append("<tem:JTGKFPRZMX_BMBH>"+dept+"</tem:JTGKFPRZMX_BMBH>");
					sb.append("<tem:JTGKFPRZMX_JTXMNR>"+xmcode+"</tem:JTGKFPRZMX_JTXMNR>");
					CtpEnumItemPO ctpEnumItem=dealDataDao.getEnum(fplx);
					sb.append("<tem:JTGKFPRZMX_FPLX>"+ctpEnumItem.getShowvalue()+"</tem:JTGKFPRZMX_FPLX>");
					sb.append("<tem:JTGKFPRZMX_FPDM>"+fpdm+"</tem:JTGKFPRZMX_FPDM>");
					sb.append("<tem:JTGKFPRZMX_FPHM>"+fphm+"</tem:JTGKFPRZMX_FPHM>");
					sb.append("<tem:JTGKFPRZMX_BHSJE>"+bhsjer+"</tem:JTGKFPRZMX_BHSJE>");
					sb.append("<tem:JTGKFPRZMX_SE>"+shuier+"</tem:JTGKFPRZMX_SE>");
					sb.append("<tem:JTGKFPRZMX_SL>"+shuil+"</tem:JTGKFPRZMX_SL>");
//					sb.append("<tem:JTGKFPRZMX_HSJE>"+jshj+"</tem:JTGKFPRZMX_HSJE>");
//					sb.append("<tem:JTGKFPRZMX_HJ>"+jszj+"</tem:JTGKFPRZMX_HJ>");
					sb.append("</tem:JTGKFPRZMX>");
				}
			}else {
				sb.append("<tem:JTGKFPRZMX></tem:JTGKFPRZMX>");
			}
			
			sb.append("</tem:JTGKFPRZMXS>");
			String fjXml=getAttaXml(attaList, id);
			sb.append(fjXml);
			sb.append("</tem:record>");
			sb.append("</tem:Write>");
			sb.append("</soap:Body>");
			sb.append("</soap:Envelope>");
			return sb.toString();
		}
		//组装内部资金拨付单接口xml
		public String getNeibuzjXml(String formRecordId,String sessionId,List<Attachment> attaList) {
			NeibuZjVO vo=dealDataDao.findNeibuZjById(Long.valueOf(formRecordId));
			Long id=vo.getId();
			String unit=vo.getUnit();
			String unitCode=vo.getUnitCode();
			String dept=vo.getDept();
			Date riqi=vo.getRiqi();
			String xmnr=vo.getXmnr();//项目内容
			BigDecimal jerzjxx=vo.getJerzjxx();//金额总计小写
			String zjjerdx=vo.getZjjerdx();//总计金额大写
			String fkyh=vo.getFkyh();//付款银行 id
			String fkyhzh=vo.getFkyhzh();//付款银行账户 银行内码
			String xgfj=vo.getXgfj();//相关附件
			
			StringBuffer sb=new StringBuffer();
			sb.append(getHeadXml(sessionId));
			//主对象
			sb.append("<tem:record>");
			sb.append("<tem:JTGKZJBF_NM>"+String.valueOf(id)+"</tem:JTGKZJBF_NM>");
			sb.append("<tem:JTGKZJBF_DWBH>"+unitCode+"</tem:JTGKZJBF_DWBH>");
			String sj=DateUtil.format(riqi, "yyyy-MM-dd");
			sb.append("<tem:JTGKZJBF_PZRQ>"+sj+"</tem:JTGKZJBF_PZRQ>");
			sb.append("<tem:JTGKZJBF_FJS></tem:JTGKZJBF_FJS>");
			sb.append("<tem:JTGKZJBF_SFNBLJ>0</tem:JTGKZJBF_SFNBLJ>");
			sb.append("<tem:JTGKZJBF_SFZF>0</tem:JTGKZJBF_SFZF>");
			//从对象
			sb.append("<tem:JTGKZJBFMXS>");
			
			List<NeibuZjSonVO> sonList=dealDataDao.findNeibuZjSon(Long.valueOf(formRecordId));
			if (sonList!=null&&sonList.size()>0) {
				for(NeibuZjSonVO sonVO:sonList) {
					sb.append("<tem:JTGKZJBFMX>");
					Long sonId=sonVO.getId();
					Long formmainId=sonVO.getFormmainId();
					String ytsm=sonVO.getYtsm();//用途说明
					BigDecimal ytjer=sonVO.getYtjer();//用途金额
					String ytbz=sonVO.getYtbz();//用途备注
					String skdwmc=sonVO.getSkdwmc();//收款单位名称
					String skdwCode=sonVO.getSkdwCode();
					String skdwkhh=sonVO.getSkdwkhh();//收款单位开户行
					String skyhid=sonVO.getSkyhid();//收款银行id
					String skyhzh=sonVO.getSkyhzh();//收款银行账号
					
					sb.append("<tem:JTGKZJBFMX_NM>"+String.valueOf(sonId)+"</tem:JTGKZJBFMX_NM>");
					sb.append("<tem:JTGKZJBFMX_ZBNM>"+String.valueOf(id)+"</tem:JTGKZJBFMX_ZBNM>");
					sb.append("<tem:JTGKZJBFMX_XMNR>"+xmnr+"</tem:JTGKZJBFMX_XMNR>");
					sb.append("<tem:JTGKZJBFMX_YTSM>"+ytsm+"</tem:JTGKZJBFMX_YTSM>");
					sb.append("<tem:JTGKZJBFMX_SKDW>"+skdwCode+"</tem:JTGKZJBFMX_SKDW>");
					sb.append("<tem:JTGKZJBFMX_KHH>"+skyhid+"</tem:JTGKZJBFMX_KHH>");
					sb.append("<tem:JTGKZJBFMX_KHHZH>"+skyhzh+"</tem:JTGKZJBFMX_KHHZH>");
					sb.append("<tem:JTGKZJBFMX_JE>"+ytjer+"</tem:JTGKZJBFMX_JE>");
					sb.append("<tem:JTGKZJBFMX_BZ>"+ytbz+"</tem:JTGKZJBFMX_BZ>");
					sb.append("<tem:JTGKZJBFMX_ZHJ>"+jerzjxx+"</tem:JTGKZJBFMX_ZHJ>");
					sb.append("<tem:JTGKZJBFMX_ZHJDX>"+zjjerdx+"</tem:JTGKZJBFMX_ZHJDX>");
					sb.append("<tem:JTGKZJBFMX_FKYH>"+fkyh+"</tem:JTGKZJBFMX_FKYH>");
					sb.append("<tem:JTGKZJBFMX_FKYHZH>"+fkyhzh+"</tem:JTGKZJBFMX_FKYHZH>");
					sb.append("</tem:JTGKZJBFMX>");
				}
			}else {
				sb.append("<tem:JTGKZJBFMX></tem:JTGKZJBFMX>");
			}
			
			sb.append("</tem:JTGKZJBFMXS>");
			attaList=dealDataDao.attachmentList(xgfj, true);
			String fjXml=getAttaXml(attaList, id);
			sb.append(fjXml);
			sb.append("</tem:record>");
			sb.append("</tem:Write>");
			sb.append("</soap:Body>");
			sb.append("</soap:Envelope>");
			return sb.toString();
		}
		//组装内部资金拨付单（内部路径）接口xml
		public String getNeibuzjNbxml (String formRecordId,String sessionId,List<Attachment> attaList) {
			NeibuZjNbVO vo=dealDataDao.findNeibuZjNbById(Long.valueOf(formRecordId));
			Long id=vo.getId();
			String unit=vo.getUnit();
			String dept=vo.getDept();
			Date riqi=vo.getRiqi();
			String xmnr=vo.getXmnr();//项目内容
			BigDecimal jerhjxx=vo.getJerhjxx();//金额总计小写
			String zjjerdx=vo.getZjjerdx();//总计金额大写
			String moreUnit=vo.getMoreUnit();
			String fkyh=vo.getFkyh();
			String fkyhzh=vo.getFkyhzh();
			String xgfj=vo.getXgfj();
			
			StringBuffer sb=new StringBuffer();
			sb.append(getHeadXml(sessionId));
			//主对象
			sb.append("<tem:record>");
			sb.append("<tem:JTGKZJBF_NM>"+String.valueOf(id)+"</tem:JTGKZJBF_NM>");
			sb.append("<tem:JTGKZJBF_DWBH>"+unit+"</tem:JTGKZJBF_DWBH>");
			String sj=DateUtil.format(riqi, "yyyy-MM-dd");
			sb.append("<tem:JTGKZJBF_PZRQ>"+sj+"</tem:JTGKZJBF_PZRQ>");
			sb.append("<tem:JTGKZJBF_FJS></tem:JTGKZJBF_FJS>");
			sb.append("<tem:JTGKZJBF_SFNBLJ>1</tem:JTGKZJBF_SFNBLJ>");
			sb.append("<tem:JTGKZJBF_SFZF>0</tem:JTGKZJBF_SFZF>");
			//从对象
			sb.append("<tem:JTGKZJBFMXS>");
			
			List<NeibuZjNbSonVO> sonList=dealDataDao.findNeibuZjNbSon(Long.valueOf(formRecordId));
			if (sonList!=null&&sonList.size()>0) {
				for(NeibuZjNbSonVO sonVO:sonList) {
					sb.append("<tem:JTGKZJBFMX>");
					Long sonId=sonVO.getId();
					Long formmainId=sonVO.getFormmainId();
					String ytsm=sonVO.getYtsm();//用途说明
					BigDecimal ytjer=sonVO.getYtjer();//用途金额
					String ytbz=sonVO.getYtbz();//用途备注
					String skdwmc=sonVO.getSkdwmc();//收款单位名称
					String skdwkhh=sonVO.getSkdwkhh();//收款单位开户行
					String skyhid=sonVO.getSkyhid();//收款银行id
					String skyhzh=sonVO.getSkyhzh();//收款银行账号
					sb.append("<tem:JTGKZJBFMX_NM>"+String.valueOf(sonId)+"</tem:JTGKZJBFMX_NM>");
					sb.append("<tem:JTGKZJBFMX_ZBNM>"+String.valueOf(id)+"</tem:JTGKZJBFMX_ZBNM>");
					sb.append("<tem:JTGKZJBFMX_XMNR>"+xmnr+"</tem:JTGKZJBFMX_XMNR>");
					sb.append("<tem:JTGKZJBFMX_YTSM>"+ytsm+"</tem:JTGKZJBFMX_YTSM>");
					sb.append("<tem:JTGKZJBFMX_SKDW>"+skdwmc+"</tem:JTGKZJBFMX_SKDW>");
					sb.append("<tem:JTGKZJBFMX_KHH>"+skyhid+"</tem:JTGKZJBFMX_KHH>");
					sb.append("<tem:JTGKZJBFMX_KHHZH>"+skyhzh+"</tem:JTGKZJBFMX_KHHZH>");
					sb.append("<tem:JTGKZJBFMX_JE>"+ytjer+"</tem:JTGKZJBFMX_JE>");
					sb.append("<tem:JTGKZJBFMX_BZ>"+ytbz+"</tem:JTGKZJBFMX_BZ>");
					sb.append("<tem:JTGKZJBFMX_ZHJ>"+jerhjxx+"</tem:JTGKZJBFMX_ZHJ>");
					sb.append("<tem:JTGKZJBFMX_ZHJDX>"+zjjerdx+"</tem:JTGKZJBFMX_ZHJDX>");
					//sb.append("<tem:JTGKZJBFMX_NBDWLJ>"+moreUnit+"</tem:JTGKZJBFMX_NBDWLJ>");
					sb.append("<tem:JTGKZJBFMX_NBDWLJ></tem:JTGKZJBFMX_NBDWLJ>");
					sb.append("<tem:JTGKZJBFMX_FKYH>"+fkyh+"</tem:JTGKZJBFMX_FKYH>");
					sb.append("<tem:JTGKZJBFMX_FKYHZH>"+fkyhzh+"</tem:JTGKZJBFMX_FKYHZH>");
					sb.append("</tem:JTGKZJBFMX>");
				}
			}else {
				sb.append("<tem:JTGKZJBFMX></tem:JTGKZJBFMX>");
			}
			sb.append("</tem:JTGKZJBFMXS>");
			attaList=dealDataDao.attachmentList(xgfj, true);
			String fjXml=getAttaXml(attaList, id);
			sb.append(fjXml);
			sb.append("</tem:record>");
			sb.append("</tem:Write>");
			sb.append("</soap:Body>");
			sb.append("</soap:Envelope>");
			return sb.toString();
		}
}
